From: Alexander Mikhaylenko Date: Thu, 4 Jul 2019 18:15:15 +0000 (+0500) Subject: workspaceAnimation: Use window clones X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~500 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9cf300c972b06a7dcb4a00cc360a95f8ba257197;p=gnome-shell.git workspaceAnimation: Use window clones Instead of reparenting windows, clone them. This will allow to properly support multi-monitor setups in subsequent commits. Block window mapping animation while the animation is running to prevent new windows appearing during the animation from being visible at the same time as their clones. Fixes https://gitlab.gnome.org/GNOME/mutter/issues/929 Part-of: --- diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index 83370b2a3..e01371c49 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -37,12 +37,16 @@ class WorkspaceGroup extends Clutter.Actor { } _syncStacking() { - const windowActors = global.get_window_actors(); - let lastSibling = null; + const windowActors = global.get_window_actors().filter(w => + this._shouldShowWindow(w.meta_window)); + + let lastRecord; for (const windowActor of windowActors) { - this.set_child_above_sibling(windowActor, lastSibling); - lastSibling = windowActor; + const record = this._windowRecords.find(r => r.windowActor === windowActor); + + this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : null); + lastRecord = record; } } @@ -51,16 +55,18 @@ class WorkspaceGroup extends Clutter.Actor { this._shouldShowWindow(w.meta_window)); for (const windowActor of windowActors) { - const record = { - windowActor, - parent: windowActor.get_parent(), - }; + const clone = new Clutter.Clone({ + source: windowActor, + x: windowActor.x, + y: windowActor.y, + }); + + this.add_child(clone); - record.parent.remove_child(windowActor); - this.add_child(windowActor); - windowActor.show(); + const record = { windowActor, clone }; record.windowDestroyId = windowActor.connect('destroy', () => { + clone.destroy(); this._windowRecords.splice(this._windowRecords.indexOf(record), 1); }); @@ -71,11 +77,7 @@ class WorkspaceGroup extends Clutter.Actor { _removeWindows() { for (const record of this._windowRecords) { record.windowActor.disconnect(record.windowDestroyId); - this.remove_child(record.windowActor); - record.parent.add_child(record.windowActor); - - if (!this._workspace.active) - record.windowActor.hide(); + record.clone.destroy(); } this._windowRecords = [];